[RUM-4720] Improve JS Refresh Rate reliability on Android #689
+170
−79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Improves JS Refresh Rate reliability.
The previous implementation registered the
VitalFrameCallback
during the SDK initialisation, and did not account for the lifecycle of the app.The new implementation stops the callback when the app is paused, resetting the last registered frame time, therefore avoiding false spikes in the framerate when the app goes to the background.
Additional Notes
The new implementation uses
ChoreographerCompat
instead ofChoreographer
for better compatibility, and it also makes sure the Choregrapher calls are performed on the UI Thread.A
UIThreadExecutor
constructor parameter inDdSdkImplementation
has also been introduced, in order to be able to inject a class to test UI Thread code correctly in the test environment.Review checklist (to be filled by reviewers)